import { http } from '@renderer/plugins/axios'
import useUtil from './useUtil'

export default () => {
  const getScanQrCode = useUtil().request(async () => {
    try {
      const res = await http.request(
        {
          url: '/getScanQrCode',
          method: 'POST',
        },
        { loading: false },
      )
      return res
    } catch (error) {
      return null
    }
  })
  const checkQrScan = useUtil().request(async (data: any) => {
    try {
      const res = await http.request(
        {
          url: '/checkQrScan',
          method: 'POST',
          data,
        },
        { loading: false },
      )
      return res
    } catch (error) {
      return null
    }
  })
  return { getScanQrCode, checkQrScan }
}
